// https://umijs.org/config/
import { defineConfig } from 'umi'
import defaultSettings from './defaultSettings'
import proxy from './proxy'

const { REACT_APP_ENV } = process.env
export default defineConfig({
  hash: true,
  antd: {},
  dva: {
    hmr: true,
  },
  history: {
    type: 'hash',
  },
  locale: {
    // default zh-CN
    default: 'zh-CN',
    // default true, when it is true, will use `navigator.language` overwrite default
    antd: false,
    baseNavigator: false,
  },
  dynamicImport: {
    loading: '@/components/PageLoading/index',
  },
  targets: {
    ie: 11,
  },
  routes: [
    {
      path: '/user',
      component: '../layouts/UserLayout',
      routes: [
        {
          name: 'login',
          path: '/user/login',
          component: './user/login',
        },
      ],
    },
    {
      path: '/',
      component: '../layouts/SecurityLayout',
      routes: [
        {
          path: '/',
          component: '../layouts/BasicLayout',
          routes: [
            {
              path: '/',
              redirect: '/workplace',
            },
            {
              name: '工作台',
              path: '/workplace',
              component: './Workplace',
              // authority: ['workplace'],
              icon:'DesktopOutlined'
            },
            {
              name: '待办列表',
              path: '/workplace/message',
              hideInMenu: true,
              component: './Workplace/Message/List',
            },
            {
              name: '自助服务',
              path: '/personnel',
              icon:'TeamOutlined',
              routes: [
                {
                  name: '360评分',
                  path: '/personnel/score',
                  component: './Personnel/Score/List',
                },
                {
                  name: '编辑评分',
                  path: '/personnel/score/edit/:obj',
                  component: './Personnel/Score/Edit',
                  hideInMenu: true,
                },
                {
                  name: '新员工转正',
                  path: '/personnel/turnPositive',
                  component: './Personnel/TurnPositive/List',
                },
                {
                  name: '管理晋升转正',
                  path: '/personnel/manage',
                  component: './Personnel/Manage/List',
                },
                {
                  name: '工资卡',
                  path: '/personnel/bankcard',
                  component: './Personnel/Bankcard/List',
                },
                {
                  name: '证明开具',
                  path: '/personnel/prove',
                  component: './Personnel/Prove',
                },
                {
                  name: '资质管理',
                  path: '/personnel/credential',
                  component: './Personnel/credential/List',
                },
                {
                  name: '合同/协议',
                  path: '/personnel/promise',
                  routes: [
                    {
                      name: '合同管理',
                      path: '/personnel/promise/contract',
                      component: './Personnel/Promise/Contract',
                    },
                    {
                      name: '协议管理',
                      path: '/personnel/promise/protocol',
                      component: './Personnel/Promise/Protocol',
                    },
                  ]
                },
                {
                  name: '晋升管理',
                  path: '/personnel/promotion',
                  routes: [
                    {
                      name: '专业晋升',
                      path: '/personnel/promotion/profession',
                      component: './Personnel/Promotion/Profession',
                    },
                    {
                      name: '管理晋升',
                      path: '/personnel/promotion/manage',
                      component: './Personnel/Promotion/manage',
                    },
                  ]
                },
                {
                  name: '离职管理',
                  path: '/personnel/resign',
                  routes: [
                    {
                      name: '离职申请',
                      path: '/personnel/resign/application',
                      component: './Personnel/Resign/Application/List',
                    },
                    {
                      name: '离职结算',
                      path: '/personnel/resign/settlement',
                      component: './Personnel/Resign/Settlement/List',
                    },
                  ]
                },
              ],
            },
            {
              name: '员工福利',
              path: '/benefits',
              icon:'GiftFilled',
              routes: [
                {
                  name: '薪酬查询',
                  path: '/benefits/paySlip',
                  component: './Benefits/PaySlip',
                },
                {
                  name: '电脑补贴',
                  path: '/benefits/subsidy/computer',
                  component: './Benefits/Computer',
                },
                // {
                //   name: '异地补贴',
                //   path: '/benefits/subsidy/offSite',
                //   component: './Benefits/OffSite',
                // },
                // {
                //   name: '住房补贴',
                //   path: '/benefits/subsidy/housing',
                //   component: './Benefits/Housing',
                // },
                // {
                //   name: '其他补贴',
                //   path: '/benefits/subsidy/other',
                //   component: './Benefits/Other',
                // },
                {
                  name: '社保查询',
                  path: '/benefits/security',
                  component: './Benefits/Security',
                },
                {
                  name: '公积金查询',
                  path: '/benefits/fund',
                  component: './Benefits/Fund',
                },
              ],
            },
            {
              name: '考勤管理',
              path: '/attendance',
              icon:'LineChartOutlined',
              routes: [
                {
                  name: '请假/调休',
                  path: '/attendance/rest',
                  routes: [
                    {
                      name: '请假调休',
                      path: '/attendance/rest/vacation',
                      component: './Attendance/Rest/Vacation',
                    },
                    // {
                    //   name: '销假申请',
                    //   path: '/attendance/rest/endHoliday',
                    //   component: './Attendance/Rest/EndHoliday',
                    // },
                    // {
                    //   name: '零星调休申请',
                    //   path: '/attendance/rest/sporadic',
                    //   component: './Attendance/Rest/Sporadic',
                    // },
                  ]
                },
                // {
                //   name: '加班模块',
                //   path: '/attendance/overtime',
                //   routes: [
                //     {
                //       name: '调班申请',
                //       path: '/attendance/overtime/shift',
                //       component: './Attendance/Overtime/Shift',
                //     },
                //     {
                //       name: '加班申请',
                //       path: '/attendance/overtime/apply',
                //       component: './Attendance/Overtime/Apply',
                //     },
                //     {
                //       name: '加班记录',
                //       path: '/attendance/overtime/record',
                //       component: './Attendance/Overtime/Record',
                //     },
                //     {
                //       name: '零星加班查询',
                //       path: '/attendance/overtime/sporadic',
                //       component: './Attendance/Overtime/Sporadic',
                //     },
                //   ]
                // },
                // {
                //   name: '排班查询',
                //   path: '/attendance/scheduling',
                //   component: './Attendance/Scheduling',
                // },
                {
                  name: '考勤查询',
                  path: '/attendance/record',
                  component: './Attendance/Record/List',
                },
              ],
            },
            {
              name: '个人中心',
              path: '/info',
              icon:'UserOutlined',
              component: './info/Index',
              routes: [
                {
                  name: '个人信息',
                  path: '/info/details',
                  component: './Info/Details',
                },
                {
                  name: '人员编辑',
                  path: '/info/edit/:employeeId',
                  hideInMenu: true,
                  component: './Info/Edit',
                },
              ],
            },
            {
              component: './404',
            },
          ],
        },
        {
          component: './404',
        },
      ],
    },
    {
      component: './404',
    },
  ],
  theme: {
    'primary-color': defaultSettings.primaryColor,
  },
  title: false,
  ignoreMomentLocale: true,
  proxy: proxy[REACT_APP_ENV || 'dev'],
  manifest: {
    basePath: '/',
  },
  publicPath: './',
})
